package com.huaqing.view;

import javax.swing.*;
import java.awt.*;

/**
 * @program: javatrainingfirstweek
 * @Description: 石头剪刀布游戏界面窗口
 * @author: Mr.Cheng
 * @date: 2022/4/26 10:07 上午
 */
public class RockPaperScissorsWindow extends JFrame{
    private JPanel jPanel;
    private JComboBox<String> comboBox;

    /**
     * Creates a new, initially invisible <code>Frame</code> with the
     * specified title.
     * <p>
     * This constructor sets the component's locale property to the value
     * returned by <code>JComponent.getDefaultLocale</code>.
     *
     * @param title the title for the frame
     * @throws HeadlessException if GraphicsEnvironment.isHeadless()
     *                           returns true.
     * @see GraphicsEnvironment#isHeadless
     * @see Component#setSize
     * @see Component#setVisible
     * @see JComponent#getDefaultLocale
     */
    public RockPaperScissorsWindow(String title) throws HeadlessException {
        super(title);
        setSize(500,600);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        init();
    }

    private void init(){
        jPanel = new JPanel();
        // 需要选择的条目
        String[] listData = new String[]{ "人", "电脑"};
        comboBox = new JComboBox<>(listData);

        jPanel.add(comboBox);

        setContentPane(jPanel);
    }
}
